home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / sndhrdw / gotya.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  1KB  |  79 lines

  1. #include "driver.h"
  2.  
  3. struct gotya_sample
  4. {
  5.     int sound_command;
  6.     int channel;
  7.     int looping;
  8. };
  9.  
  10.  
  11. static struct gotya_sample gotya_samples[] =
  12. {
  13.     { 0x01, 0, 0 },
  14.     { 0x02, 1, 0 },
  15.     { 0x03, 2, 0 },
  16.     { 0x05, 2, 0 },
  17.     { 0x06, 3, 0 },
  18.     { 0x07, 3, 0 },
  19.     { 0x08, 0, 1 },
  20.     { 0x0a, 0, 0 },
  21.     { 0x0b, 0, 0 },
  22.  
  23. /* all the speech can go to one channel? */
  24.  
  25.     { 0x10, 3, 0 },
  26.     { 0x11, 3, 0 },
  27.     { 0x12, 0, 0 },        /* this should stop the main tune */
  28.     { 0x13, 3, 0 },
  29.     { 0x14, 3, 0 },
  30.     { 0x15, 3, 0 },
  31.     { 0x16, 3, 0 },
  32.     { 0x17, 3, 0 },
  33.     { 0x18, 3, 0 },
  34.     { 0x19, 3, 0 },
  35.     { 0x1a, 3, 0 },
  36.     {   -1, 0, 0 }        /* end of array */
  37. };
  38.  
  39. WRITE_HANDLER( gotya_soundlatch_w )
  40. {
  41.     static int theme_playing;
  42.     int sample_number;
  43.  
  44.  
  45.     if (data == 0)
  46.     {
  47.         sample_stop(0);
  48.         theme_playing = 0;
  49.         return;
  50.     }
  51.  
  52.     /* search for sample to play */
  53.  
  54.     for (sample_number = 0;
  55.          gotya_samples[sample_number].sound_command != -1;
  56.          sample_number++)
  57.     {
  58.         if (gotya_samples[sample_number].sound_command == data)
  59.         {
  60.             if (gotya_samples[sample_number].looping &&
  61.                 theme_playing)
  62.             {
  63.                 /* don't restart main theme */
  64.                 return;
  65.             }
  66.  
  67.             sample_start(gotya_samples[sample_number].channel,
  68.                          sample_number,
  69.                          gotya_samples[sample_number].looping);
  70.  
  71.             if (gotya_samples[sample_number].channel == 0)
  72.             {
  73.                 theme_playing = gotya_samples[sample_number].looping;
  74.             }
  75.             return;
  76.         }
  77.     }
  78. }
  79.